﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using tool;
using UnityEngine;
using Debug = UnityEngine.Debug;

public class GameManager : MonoBehaviour
{
    public static GameManager Instance;
    public Board board;
    public Cube cube;

    private void Awake()
    {
        Instance = this;
    }

    private void Start()
    {
        Init();
        
    }

    void Init()
    {
        board.Init();
        CreateCube();
    }

    public void CreateCube()
    {
        cube = new GameObject("cube").AddComponent<Cube>();
        cube.position = new Vector2(5, 19);
    }


   

    private void Update()
    {
        // if (Input.GetKey(KeyCode.S))
        // {
        //     if (Tool.Timer(currentTime, jiangeTime))
        //     {
        //         Debug.Log("按键");
        //         cube.Down();
        //     }
        // }
        

        
        if (TimerManager.CheckTimeUp("aaa",Time.deltaTime,0.3f))
        {
            Debug.Log("aaa");
        }
        
        
        
        if (Input.GetKey(KeyCode.S))
        {
            // Timer2.SetInterval(0.3f);
            // Timer2.AddTime(Time.deltaTime);
            // if (Timer2.CheckTimeUp())
            // {
            //     Debug.Log("按键");
            //     cube.Down();
            // }
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            cube.Rotation();
        }

        if (Input.GetKeyDown(KeyCode.A))
        {
            cube.Left();
        }

        if (Input.GetKeyDown(KeyCode.D))
        {
            cube.Right();
        }

        // if (Input.GetKeyDown(KeyCode.S))
        // {
        //     cube.Down();
        // }
    }
}